<template>
	<view class="wrap">
		<text>
			<rich-text :nodes="content"></rich-text>
		</text>
	</view>
</template>

<script>
	import {
		userAgree,
	} from "../../api/login.js"
	export default {
		data() {
			return {
				type: "",
				content: ""
			}
		},
		onLoad(options) {
			if (options.type) {
				this.type = options.type
				switch (options.type) {
					case "user":
						uni.setNavigationBarTitle({
							title: "用户协议"
						})
						break;
					case "privacy":
						uni.setNavigationBarTitle({
							title: "隐私政策"
						})
						break;
					case "announcement":
						uni.setNavigationBarTitle({
							title: "宣文介绍"
						})
						break;
					case "binding":
						uni.setNavigationBarTitle({
							title: "绑定介绍"
						})
						break;
					case "love":
						uni.setNavigationBarTitle({
							title: "情侣协议"
						})
						break;
					case "bestie":
						uni.setNavigationBarTitle({
							title: "闺蜜协议"
						})
						break;
					case "share":
						uni.setNavigationBarTitle({
							title: "分享版介绍"
						})
						break;
					case "share":
						uni.setNavigationBarTitle({
							title: "分享版介绍"
						})
						break;
					case "permanent":
						uni.setNavigationBarTitle({
							title: "永久版介绍"
						})
						break;
					case "oath":
						uni.setNavigationBarTitle({
							title: "誓言版介绍"
						})
						break;
					case "time":
						uni.setNavigationBarTitle({
							title: "时间锁介绍"
						})
						break;
					case "my":
						uni.setNavigationBarTitle({
							title: "关于我们"
						})
						break;
					case "cooperation":
						uni.setNavigationBarTitle({
							title: "合作联系"
						})
						break;
					case "realname":
						uni.setNavigationBarTitle({
							title: "实名认证服务协议"
						})
						break;
				}
			}
			this.getData()
		},
		methods: {
			async getData() {
				let res = await userAgree(this.type)
				this.content = res.data.agreement_content
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: white;
	}

	.wrap {
		width: 100%;
		overflow: hidden;
		padding: 20rpx;
		padding-bottom: env(safe-area-inset-bottom);
		box-sizing: border-box;
		color: #252525;
		font-size: 34rpx;
		font-weight: bold;
	}
</style>